#include <stdio.h>
#include <stdlib.h>
#include "util.h"
#include "semant.h"
#include "symbol.h"
#include "env.h"
#include "translate.h"
#include "escape.h"
#include "tree.h"
#include "printtree.h"

#define DOUBLE_WOR

extern A_exp absyn_root;
extern FILE *yyin;
extern char *yytext;
extern void yyparse();

extern void EM_reset(char*);
extern void destroy(A_exp);

int main(int argc, char **argv)
{
    FILE *outfile;
    T_stmList list;
    EM_reset("test.bm");
    if (!yyin)
    {
        fprintf(stderr, "Can't open file!\n");
        exit(1);
    }

    yyparse();
    if (!absyn_root)
        exit(1);

    list = SEM_transProg(absyn_root);
    outfile = fopen("tree.out","w");
    printStmList(outfile, list);
    fclose(outfile);

    exit(0);
}
